# Maintainer: leso-kn <info@lesosoftware.com>
pkgname=pebble-le
pkgver=0.3.0
pkgrel=0
_bluez_inc="41bdc1a5d98d929764600c14d0654c9ff5112f86"
pkgdesc="Library to talk to Pebble Smartwatches via Bluetooth Low Energy (BLE)"
url="https://github.com/leso-kn/pebble-le"
arch="all"
license="MIT"
makedepends="
	boost-dev
	cmake
	doxygen
	fmt-dev
	dbus-dev
	glib-dev
	samurai
	simpleble-dev
	"
install="$pkgname.pre-install"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/leso-kn/pebble-le/archive/refs/tags/v$pkgver.tar.gz
	bluez_inc-$_bluez_inc.tar.gz::https://github.com/weliem/bluez_inc/archive/$_bluez_inc.tar.gz
	simpleble.patch
	"
options="!check" # soon pebble-le unit-tests

prepare() {
	rmdir third_party/binc third_party/SimpleBLE

	mv "$srcdir"/bluez_inc-$_bluez_inc third_party/binc
	default_prepare
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_INSTALL_INCLUDEDIR=/usr/include \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DCMAKE_SKIP_INSTALL_RPATH=ON
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
8672d481e0dc94f648149627bdc413d0546750683d994b7b4b67c90216f14877fcaa9eba723ee0fdf9016505b3e49e58d605c3e1cd3e3bc4d4ad01400e68844b  pebble-le-0.3.0.tar.gz
2321fb7cdddbde7208c92185bc5af9083fc313b8ae2433308423b6ce5c1895b19bf27671ca6f352bd10a62b7ed830586d973268bc8ab547943180d64fdc72081  bluez_inc-41bdc1a5d98d929764600c14d0654c9ff5112f86.tar.gz
77f49061da9dfef1e1765df2dcf5633a0d1ea95ced4e7276a5abee98b98108ec0dc53d4e3e27d58abb1f280afccc53f6724d5957e898d13f69c05470d84a8580  simpleble.patch
"
